package com.fh.service.impl;

import com.fh.mapper.TimeOutQueryMapper;
import com.fh.model.Orders;
import com.fh.service.TimeOutQueryService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class TimeOutQueryServiceImpl implements TimeOutQueryService {

    @Resource
    private TimeOutQueryMapper timeOutQueryMapper;

    @Override
    public List<Orders> query() {
        Example example = new Example(Orders.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("status","1");
        //当前时间的半个小时前
        Date time=new Date( System.currentTimeMillis()-30*60*1000);
        criteria.andLessThan("createTime",time);
        List<Orders> orders = timeOutQueryMapper.selectByExample(example);
        return orders;
    }
}
